import request from '@/router/axios';

/**
 * 生成原材料包装条码
 */
export const createSequence = (row) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/sequence/create',
    method: 'post',
    data: row
  });
};

/**
 * 打印条码
 */
export const printSequence = (row) => {
  return request({
    url: '/api/mes-admin/label-material/sequence/print',
    method: 'post',
    data: row
  });
};
// 打印测试
export const printTest = (row) => {
  return request({
    url: '/api/mes-admin/api/print/test',
    method: 'post',
    data: row
  });
};

/**
 * 原材料-其他生成
 */
export const sequenceCreateByPart = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/sequence/part-master/create',
    method: 'post',
    data: data
  });
};

//原材料包装条码打印 重构
export const sequenceCreate = (data) => {
  return request({
    url: '/api/mes-admin/label-material/sequence/create',
    method: 'post',
    data: data
  });
};

/**
 * 原材料-其他打印
 */
export const sequenceAppendByPart = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/sequence/part-master/print',
    method: 'post',
    data: data
  });
};

/**
 * 物料补打
 */
export const sequenceCreatePartPatch = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/sequence/part-master/generation',
    method: 'post',
    data: data
  });
};

/**
 * 根据原材料收料记录id查询生成记录
 */
export const getSourceList = (params) => {
  return request({
    url: '/api/mes-admin/sequence/generation/source',
    method: 'get',
    params: params
  });
};

export const getInOutSourceList = (params) => {
  return request({
    url: '/api/mes-admin/label-material/tree-pack/get-latest-not-print-generation-detail',
    method: 'get',
    params: params
  });
};
// 预览
export const previewGenerationInOutSourceList = (params) => {
  return request({
    url: '/api/mes-admin/label-material/tree-pack/sequence-preview',
    method: 'POST',
    data: params
  });
};
// 生成
export const generationInOutSourceList = (params) => {
  return request({
    url: '/api/mes-admin/label-material/tree-pack/sequence-create',
    method: 'POST',
    data: params
  });
};

// 详情
export const inOutSourceList = (params) => {
  return request({
    url: '/api/mes-admin/label-material/tree-pack/page-label-material',
    method: 'GET',
    params: params
  });
};

export const inOutReprint = (params) => {
  return request({
    url: '/api/mes-admin/label-material/tree-pack/sequence-reprint',
    method: 'POST',
    data: params
  });
};

export const inOutPrint = (params) => {
  return request({
    url: '/api/mes-admin/label-material/tree-pack/sequence-print',
    method: 'POST',
    data: params
  });
};

// 获取退货项
export const getSalesReturnList = (params) => {
  return request({
    url: '/api/mes-warehouse/sheetheader/sheet-detail/page-with-part-master',
    method: 'get',
    params: params
  });
};

// 销售退货标签补打
export const getSalesReturnPrint = (params) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/generate-for-sales-return',
    method: 'POST',
    data: params
  });
};
// 产品标签生产 内部自定义规则生成序列号
export const cumstomSequenceCreate = (data) => {
  return request({
    url: '/api/mes-product/workorder/generation/normalWithoutDefinitionId',
    method: 'post',
    data: data
  });
};

// 获取参数管理是否允许多行收料记录打印
export const getIsAllowMultiplePrint = () => {
  return request({
    url: '/api/blade-system/param/list',
    method: 'get',
    params: {
      paramKey: 'is_allow_multiple_print',
      size: 10,
      current: 1
    }
  });
};

export const sequenceSupplement = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/sequence/append',
    method: 'post',
    data: data
  });
};
